import numpy as np
from model.utils import acc_dist, finish_prob
import heapq
from utils2_test import get_topk, get_dict_fmt, get_topk_for_test
import json


# order、driver文件
order_file = r'../data2/order_20161101_180s.csv'
drive_file = r'../data2/driver_20161101_180s.csv'

# 打开order、driver文件
with open(order_file) as f:
    orders = np.loadtxt(f, str, delimiter = ",")

with open(drive_file) as f:
    drivers = np.loadtxt(f, str, delimiter = ",")

# 一对一的情况
list = []
order_count = 0
for order in orders:

    top11_drivers = get_topk_for_test(order, drivers)
    list_to_json = get_dict_fmt(order, top11_drivers)
    list.extend(list_to_json)

    order_count += 1

print(order_count)

# fp = open('dispatch_observ', 'w')
# json.dump(list, fp)